/*******************************************************************************
 *  Container class
 *******************************************************************************

// options example
var options = {
    id: 'id',
    title: 'title',
    showTitle: true
}

*/

var Container = function(options, suffix) {
    
    // this class should extend an Element class
    $.extend(true, this, new Element($('<div>')))
    
    // ------------------------------------------------------- fields
    this.title = null;
    
    // ------------------------------------------------------- settings
    
    this.defaults = {
        showTitle: true
    };
    
    var settings = this.prepareSettings(options);
    settings.id = settings.id + '-' + suffix;
    
    // ------------------------------------------------------- methods
    
    /**
     *  Sets title
     *  @param title defines step title text
     *  @return class instance
     */
    this.setTitle = function(title){
        if(title) {
            this._getTitle()
                .html('')
                .append($('<div class="sidebar-inner sidebar-title">').text(title));
        }
        return this;
    }
    
    this._getTitle = function(){
        if(!this.title){
            // creates title
            this.title = $('<div>').addClass('sidebar');
            this.getElement().prepend(this.title);
        }
        return this.title;
    }
    
    // ------------------------------------------------------- preparing
    this.setId(settings.id);
    if(settings.showTitle) this.setTitle(settings.title);
        
    console.log('Container was created with id = '+this.getId());
}